/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tuitionmanagement.components;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;


/**
 *
 * @author Home
 */
public class ImageDesktopPane extends JDesktopPane {
     ImageIcon img;
    public ImageDesktopPane(){
        super();
        img=new ImageIcon("bg_image.jpg");
        int h=img.getIconHeight();
        int w=img.getIconWidth();
        this.setPreferredSize(new Dimension(w, h));
       // this.setSize(w,h);
       // this.setMinimumSize(new Dimension(w,h));
    
    }
    
    @Override
    public void paint(Graphics g){
      
       if(this.getComponentCount()==0){
        int x=(this.getWidth()-img.getIconWidth())/2;
        int y=(this.getHeight()-img.getIconHeight())/2;
        g.drawImage(img.getImage(), x, y, null);
        return;
 }
       super.paint(g);
     
    }

}
